<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>打印变量的相关信息</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.unset.html">unset</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.var-export.html">var_export</a></div>
 <div class="up"><a href="ref.var.html">Variable handling 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.var-dump" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">var_dump</h1>
    <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">var_dump</span> &mdash; <span class="dc-title">打印变量的相关信息</span></p>

   </div>
   
 <div class="refsect1 description" id="refsect1-function.var-dump-description">
  <h3 class="title">说明</h3>
     <div class="methodsynopsis dc-description">
      <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>var_dump</strong></span>
       ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$expression</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$...</code></span>
     ] )</div>

    <p class="simpara">
     此函数显示关于一个或多个表达式的结构信息，包括表达式的类型与值。数组将递归展开值，通过缩进显示其结构。
    </p>
    <p class="simpara">
   In PHP 5 all public, private and protected properties of objects will be
   returned in the output.
  </p>
    <div class="tip"><strong class="tip">Tip</strong><p class="simpara">和直接将结果输出到浏览器一样，可使用<a href="book.outcontrol.html" class="link">输出控制函数</a>来捕获当前函数的输出，然后(例如)保存到一个 <span class="type"><a href="language.types.string.html" class="type string">string</a></span> 中。</p></div>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.var-dump-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">expression</code></em></dt>

     <dd>

      <p class="para">
       你要打印的变量。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.var-dump-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.var-dump-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5164">
    <p><strong>Example #1 <span class="function"><strong>var_dump()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$a&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"a"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"b"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"c"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(3) {
  [0]=&gt;
  int(1)
  [1]=&gt;
  int(2)
  [2]=&gt;
  array(3) {
    [0]=&gt;
    string(1) &quot;a&quot;
    [1]=&gt;
    string(1) &quot;b&quot;
    [2]=&gt;
    string(1) &quot;c&quot;
  }
}
</pre></div>
    </div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$b&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">3.1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
float(3.1)
bool(true)
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.var-dump-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.var-export.html" class="function" rel="rdfs-seeAlso">var_export()</a> - 输出或返回一个变量的字符串表示</span></li>
    <li class="member"><span class="function"><a href="function.print-r.html" class="function" rel="rdfs-seeAlso">print_r()</a> - 打印关于变量的易于理解的信息。</span></li>
   </ul>
  </p>  
 </div>

  </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.unset.html">unset</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.var-export.html">var_export</a></div>
 <div class="up"><a href="ref.var.html">Variable handling 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
